home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Demos / Component Software / FileFlex 2.0.3.sit / FileFlex 2.0.3 / Unsupported & Undocumented / Char Translation Example / 00002.ls < prev    next >
Encoding:
Text File  |  1996-04-10  |  1011 b   |  45 lines

  1. on buildTranslateTable_ASCIIX
  2.   global ASCIIX
  3.   set theTable to EMPTY
  4.   repeat with i = 0 to 255
  5.     if i = 0 then
  6.       put numToChar(255) after theTable
  7.       next repeat
  8.     end if
  9.     put numToChar(i) after theTable
  10.   end repeat
  11.   set ASCIIX to theTable
  12. end
  13.  
  14. on buildTranslateTable_CaseReverseX
  15.   global CaseReverseX, ASCIIX
  16.   buildTranslateTable_ASCIIX()
  17.   set theTable to ASCIIX
  18.   repeat with i = 65 to 90
  19.     put numToChar(i + 32) into char i + 1 of theTable
  20.   end repeat
  21.   repeat with i = 97 to 122
  22.     put numToChar(i - 32) into char i + 1 of theTable
  23.   end repeat
  24.   set CaseReverseX to theTable
  25. end
  26.  
  27. on showTable theTable
  28.   repeat with i = 1 to 256
  29.     set tableRecord to padNum(i - 1) & ": "
  30.     put padNum(charToNum(char i of theTable)) after tableRecord
  31.     put " " & char i of theTable after tableRecord
  32.     put tableRecord
  33.   end repeat
  34. end
  35.  
  36. on padNum num
  37.   if num < 10 then
  38.     return "00" & string(num)
  39.   end if
  40.   if num < 100 then
  41.     return "0" & string(num)
  42.   end if
  43.   return string(num)
  44. end
  45.